package com.pointmi.customeraccountservice;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;

import com.pointmi.customeraccountdao.CustomerAccountDAO;
import com.pointmi.customeraccountdao.Customer;
import com.pointmi.customeraccountdao.PasswordReset;


public class CustomerAccountServiceImpl implements CustomerAccountService {

	@Autowired
	@Qualifier("customerDAO")
	CustomerAccountDAO customerDao;
	
	public void setCustomerAccountDAO(CustomerAccountDAO customerDao)
	{
		this.customerDao = customerDao;
	}
	
	public void saveOrUpdate(Customer newCustomer) {
		customerDao.saveOrUpdate(newCustomer);
	}

	public void saveOrUpdate(PasswordReset newDetails) {
		customerDao.saveOrUpdate(newDetails);
	}

	public Customer findCustomerByEmail(String email) {
		return customerDao.findCustomerByEmail(email);
	}

	public Customer findCustomerByEmailOrCustomerId(String email, String customerId) {
		return customerDao.findCustomerByEmailOrCustomerId(email, customerId);
	}
	
	public Customer findCustomerByEmailAndPassword(String email, String password)
	{
		return customerDao.findCustomerByEmailAndPassword(email, password);
	}
}
